package com.life.dao.service;



import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.metadata.ClassMetadata;


public interface IGenericManager<T, PK extends Serializable> {

	List<T> getAll();

	List<T> getAll(Map<String, Object> equalMap, Map<String, Object> orderMap);

	List<Object> getListByParm(String queryName, Object[] value);

	T get(PK id);

	void evict(Object obj);

	void mergeObj(Object object);
	
	void clearFlush();

	boolean exists(PK id);

	T save(T object);

	void updateObj(Object obj);

	void updateList(List list);

	void update(List<T> list);

	void saveList(List list);

	void save(List<T> list);
	
	void exceuteSql(String sql);

	void update(T object);

	void remove(PK id);
	
	void remove(T object);

	public void flush();

	public void saveObj(Object obj);
	
	/**
	 * 
	 * @param obj
	 */
	public Object saveObjSuper(Object obj);

	public void saveOrUpdateObj(Object obj);

	public int excuteUpdateColl(String queryNameStr, Object[] obj);

	int excuteUpdate(String queryName, Map<String, Object> paraMap);

	List<T> getDocAll(Map<String, Object> parmMap);

	List getListByParm(String queryName, Object[] pValueArray, Class cls);

	List getListByParm(String queryName, Object[] pValueArray, Class cls, int start, int pagesize);

	List getListByParm(String queryName, String[] pNameArray, Object[] pValueArray, Class cls);

	List getListByParm(String queryName, Map<String, Object> paraMap, Class cls);

	List getPageListByParm(String queryName, Map<String, Object> paraMap, Class cls,int start, int pagesize);

	List getListByNamedQuery(String queryName, Map<String, Object> paraMap);

	List getListByCriteria(DetachedCriteria criteria);

	List getListByNamedQueryParas(String queryName, Map<String, Object> paraMap);

	List getListByNamedQuery(String queryName);

	List<T> getListBySql(String queryName, String whereSql, Class cls, int start, int pagesize);

	List<T> getListBySql(String queryName, String whereSql, Class cls);

	ClassMetadata getClassMetadata(Class<?> clsPo);

	String getIdentifierPropertyName(Class<?> clsPo);
	
	void updateBySql(String sql);
	
	public List<Object> getListByNativeSql(String sql, Class cls, int start, int pagesize);
	
	public List<Object> getListByNativeSql(String sql,int start, int pagesize);
	
	public List<Object> getListByNativeSql(String sql, Class cls);
	
	public List<Object> getListByNativeSql(String sql);
	
	   public Integer getCountByNativeSql(String sql);
	   
	   /**
		 * 调用存储过程
		 * @param inputArgs			输入参数集合
		 * @param outTypes			输出参数类型集合
		 * @param procedureName  过程名称
		 * @return
		 * @throws Exception
		 */
	   public List<Object> execProc(List inputArgs,List outTypes,String procedureName) throws Exception;
}
